package com.alumni_circle.core.entity;

import com.alumni_circle.core.constant.ResponseCode;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * "@JsonInclude(JsonInclude.Include.NON_NULL)",jackson 实体转json 为NULL的字段不参加序列化（即不显示）
 * @param <T>
 */

/**
 * @author 龙小虬
 *
 * 基于BaseResponseModel，增加返回单个对象
 */
@EqualsAndHashCode(callSuper = true)
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseModel<T> extends BaseResponseModel{
    /**
     * 数据
     */
    private T result;

    public ResponseModel() {
        super(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMessage());
    }

    public ResponseModel(T result) {
        super(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMessage());
        this.result = result;
    }

    public ResponseModel(int code, String message) {
        super(code, message);
    }

    public ResponseModel(T result, int code, String message) {
        super(code, message);
        this.result = result;
    }

}
